<html>
<head><title>Request Play</title></head>
<body style="background-color: black; color: white;">

<div>
	<form action="request.php">

	Youtube url: <input style="width: 250px;" type="text" name="video"/> <input type="submit"/>
	</form>

	<div style="margin-top: 20px;">
<?php
	echo $_GET["msg"]
?>
	</div>

	<div style="margin-top: 20px;">
	Current Queue:
<?php

$mysqli = new mysqli("test.com", "test", "test", "test");
if(mysqli_connect_errno()){
  die("Could not resolve mysql connection.");
}

$results = $mysqli->query("select * from history where played = 0;");

if($results){
    $numrows = mysqli_num_rows($results);
    if($numrows == 0){
        echo "Empty";
    }

    while($row = $results->fetch_object()){
        echo "<div style='margin-top: 5px;'>" . $row->title . "</div>";
    }
}
?>
	</div>
	<div style="margin-top: 20px;">
	Recently Played:
<?php

$results = $mysqli->query("select * from history where played = 1 order by reqtime desc limit 5;");

if($results){
    while($row = $results->fetch_object()){
       echo "<div style='margin-top: 5px;'><a style='color: white;' href='http://youtube.com/watch?v=" . $row->video . "'>" . $row->title . "</a> - " . $row->reqtime . "</div>";
    }
}

$mysqli->close();
?>
	</div>

</div>

</body>
</html>